package com.shuxinxin.test.pojo;

public class Result<E> {
    private Integer code;
    private String msg;
    private E data;

    public static <E> Result<E> success() {
        return new Result<>(0, "请求成功!", null);
    }

    static public <E> Result<E> success(E data) {
        return new Result<>(0, "请求成功!", data);
    }

    static public Result error(String msg){
        return new Result(1,msg,null);
    }

    public Result(Integer code, String msg, E data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public E getData() {
        return data;
    }

    public void setData(E data) {
        this.data = data;
    }
}
